package com.atguigu.sprigcloud.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RefreshScope
//当config center的配置出现变动时，运维人员还需要向本微服务发送一个post请求以刷新本微服务的配置 例如cmd种发送 curl -X POST "http://localhost:3355/actuator/refresh"    注意必须是post请求
public class ConfigClientController {
    @Value("${config.info}")
    private String configInfo;

    @Value("${server.port}")
    private String serverPort;

    @GetMapping("/configInfo")
    public String getConfigInfo() {
        return "serverPort: " + serverPort + "\t\n\n configInfo:" + configInfo;
    }
}
